package com.xoms.pad.persist.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.xoms.pad.model.ProCategory3Bean;
import com.xoms.pad.model.ProCategoryBean;
import com.xoms.pad.persist.dao.ProCategoryDao;
import com.xoms.util.StringUtil;


@Repository
public class ProCategoryImpl extends BaseImpl implements ProCategoryDao {

	final String NAME_SPACE = NAME_SPACE_HEADER + ".ProCategoryMapper";

	
	@Override
	public List<ProCategoryBean> selectAllCates() {
		return sqlSessionTemplate.selectList(NAME_SPACE + ".selectAllCates");
	}
	
	@Override
	public List<ProCategory3Bean> getCate3ProductByCate2(String categoryId) {
		Map<String, Object> params = new HashMap<String, Object>();
		if (!StringUtil.isEmpty(categoryId)) {
			params.put("categoryId", categoryId);
		}
		return sqlSessionTemplate.selectList(NAME_SPACE + ".selectCate3s", params);
	}

	@Override
	public List<ProCategory3Bean> getCate3ProductByCate3Id(String categoryId) {
		Map<String, Object> params = new HashMap<String, Object>();
		if (!StringUtil.isEmpty(categoryId)) {
			params.put("categoryId", categoryId);
		}
		return sqlSessionTemplate.selectList(NAME_SPACE + ".selectCate3sByCate3Id", params);
	}

}
